<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增课程')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-main-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">课程代码：</label>
                <div class="col-sm-8">
                    <input name="courseCode" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">课程名称：</label>
                <div class="col-sm-8">
                    <input name="courseName" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">学时：</label>
                <div class="col-sm-8">
                    <input name="studyTime" class="form-control" type="number" required placeholder="请填写数字：(如：2)">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">学分：</label>
                <div class="col-sm-8">
                    <input name="studyScore" class="form-control" type="number" required placeholder="请填写数字：(如：5)">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">负责人：</label>
                <div class="col-sm-8">
                    <select class="form-control" name="teacherName" id="teacherName" th:with="teacherNames=${@user.getUserName()}" required>
                        <option value="">请选择</option>
                        <option th:each="teacherName : ${teacherNames}" th:text="${teacherName.userName}" th:value="${teacherName.userName}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">年级：</label>
                <div class="col-sm-8">
                    <input name="tbClass" class="form-control" type="text" required>
                </div>
            </div>
            <!--字典的使用-->
            <div class="form-group">
                <label class="col-sm-3 control-label">专业：</label>
                <div class="col-sm-8">
                 <select name="profession" class="form-control m-b" th:with="type=${@dict.getType('sys_profession')}" required>
                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                 </select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "website/totalcourse"
        $("#form-main-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-main-add').serialize());
            }
        }
    </script>
</body>
</html>